package Practice;

import java.util.Arrays;
import java.util.Scanner;

public class Sing {
    public static double grade(int[] arr) {
        Arrays.sort(arr);
        int num = 0;
        for (int i = 1; i < arr.length - 1; i++) {
            num += arr[i];
        }
        double count = (double) num / (arr.length - 2);
        return count;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),m = sc.nextInt();
        int[] a = new int[m];
        double[] b = new double[n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                a[j] = sc.nextInt();
            }
            b[i] = grade(a);
        }
        Arrays.sort(b);
        System.out.printf("%.2f",b[n-1]);
    }
}
